package com.atguigu.srb.core.controller.admin;


import com.atguigu.srb.base.result.ResponseVo;
import com.atguigu.srb.core.pojo.entity.LendItem;
import com.atguigu.srb.core.service.LendItemService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 标的出借记录表 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2023-03-25
 */
@RestController
@RequestMapping("/admin/core/lendItem")
public class AdminLendItemController {
    @Resource
    LendItemService lendItemService;
    @ApiOperation("查询标的的投资列表")
    @GetMapping("list/{lendId}")
    public ResponseVo listByLendId(@PathVariable("lendId")Long lendId){
        List<LendItem> items = lendItemService.list(Wrappers.lambdaQuery(LendItem.class)
                .eq(LendItem::getLendId, lendId)
                .orderByDesc(LendItem::getUpdateTime));
        return ResponseVo.ok().data("items",items);

    }



}

